﻿<?php
$msg="---请填写基本信息---";
if($_POST['submit']){
// generate and execute a query
require_once 'dbconn.php';
$uname=$_POST['uname'];
$upwd=md5($_POST['upwd']);
$secque=$_POST['usecq'];
$secans=$_POST['useca']; 
$mail=$_POST['uemail'];
$name=$_POST['tname'];
$sex=$_POST['sex'];
$bday=$_POST['ubirthday'];
$college=$_POST['college'];
$grade=$_POST['grade'];
$dorm=$_POST['dorm'];
$dept=$_POST['dept'];
$phone=$_POST['phone'];
$short=$_POST['short'];
$qq=$_POST['qq'];
$query= "insert into users(uname,upwd,secque,secans,mail,name,sex,bday,college,grade,dorm,dept,phone,short,qq) values('" .$uname. "','". $upwd. "','". $secque. "','". $secans. "','". $mail. "','". $name. "','". $sex."','".$bday."','".$college."','".$grade."','".$dorm."','".$dept."','".$phone."','".$short."','".$qq."');";
/*$result = pg_query($connection, $query) or die("Error in query: " . $query .
	 " " . pg_last_error($connection));*/
$result=$db->sql_query($query);
 if ($result)
        $msg="注册成功！<a href='home.php'>请点击此处重新登录!</a>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户注册</title>
<link href="css/twoColFixLtHdr.css" rel="stylesheet" type="text/css" />
</head>
<body class="twoColFixLtHdr">
<div id="logo"></div>
<div id="navi"><table border="0" cellpadding="0" cellspacing="0"><tr>
<td><label><a href="home.html">首页<br />Home</a></label></td>
<td><label><a href="share.html">资源共享<br />Share</a></label></td>
<td><label><a href="album.html">相册<br />Album</a></label></td>
<td><label><a href="msgboard.html">留言板<br />Msgboard</a></label></td>
<td><label><a href="table.html">表格下载<br />Table</a></label></td>
</tr></table>
</div>
<div id="register">
<div id="container">
<br /><h1>IBM俱乐部会员注册</h1>
<hr size="5" color="#9D9D9D" />
<hr size="5" color="#9D9D9D" />
</div>
<form action="" method="post" name="register">
<table border="0" cellpadding="0" cellspacing="20">
<tr><th></th><td style="font-size:x-large;"><?php echo $msg;?></td></tr>
<tr><th>用户名：</th>
<td><input type="text" name="uname" size="30" /></td></tr>
<tr><th>密码：</th>
<td><input type="password" name="upwd" size="30" /></td></tr>
<tr><th>重复密码：</th>
<td><input type="password" name="urepwd" size="30" /></td></tr>
<tr><th>Email：</th>
<td><input type="text" name="uemail" size="30" /></td></tr>
<tr><th>安全提问：</th><td><select name="usecq" >
<OPTION value=0 selected>选择</OPTION>
<OPTION >你的出生地点</OPTION>
<OPTION >儿童时期的最好朋友&nbsp;&nbsp;</OPTION>
<OPTION >第一个宠物的名字</OPTION>
<OPTION >最喜欢的老师</OPTION>
<OPTION >最喜欢的历史人物</OPTION>
<OPTION >你所在的学校</OPTION></select></td></tr>
<tr><th>安全提问答案：</th>
<td><input type="text" name="useca" size="30" /></td></tr>
<tr><th>真实姓名：</th><td><input type="text" name="tname" size="30" /></td></tr>
<tr><th>性别：</th><td>&nbsp;&nbsp;&nbsp;<input type="radio" name="sex" value="男"/>男&nbsp;&nbsp;&nbsp;
<input type="radio" name="sex" value="女"/>女</td></tr>
<tr><th>出生日期：</th><td><input type="text" name="ubirthday" size="30" />（示例：2010/01/01）</td></tr>
<tr><th>手机：</th><td><input type="text" name="phone" size="30" /></td></tr>
<tr><th>短号：</th><td><input type="text" name="short" size="30" /></td></tr>
<tr><th>QQ：</th><td><input type="text" name="qq" size="30" /></td></tr>
<tr><th>所在学院：</th><td><input type="text" name="college" size="30" /></td></tr>
<tr><th>年级：</th><td><input type="text" name="grade" size="30" /></td></tr>
<tr><th>宿舍地址：</th><td><input type="text" name="dorm" size="30" /></td></tr>
<tr><th>所在俱乐部部门：</th><td><input type="text" name="dept" size="30" /></td></tr>
<tr><th>&nbsp;</th><td style="text-align:center;"><input type="submit" name="submit" value="提交" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" value="取消" onclick="window.location.reload('home.html');"/></td></tr>
</table><br />
</form>
</div>
<div id="footer">
<p>Copyright © 2010 IBM club,Shenzhen University, All Rights Reserved.</p></div>
</div>
</body>
</html>

